﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Mvc.Common;
@using FwProject.PrePaymentInfo.Dto
@model IPagedList<PrePaymentInfoOutputDto>
@{
    Layout = null;
}
<div style="max-height:600px;overflow-y:scroll;" id="table_print">

    <table class="table table-bordered table-hover table-rowselected">
        <thead>
            <tr>
                <th>状态</th>
                <th>日期</th>
                <th>单号</th>
                <th>经办人</th>
                <th>餐厅</th>
                <th>账户</th>
                <th>预收金额</th>
                <th style="width:200px;">操作</th>
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td colspan="8">暂无预收款信息</td></tr>
            }
            else
            {
                foreach (var item in Model)
                {
                    <tr>
                        <td>@item.PrePaymentInfoStatus</td>
                        <td>@item.CreationTime.ToString("yyyy-MM-dd hh:mm:ss")</td>
                        <td><a href="javascript:top.window.openTab(1120,'预收单[@item.PrePaymentInfoNumber]','@Url.Action("EditAdvancePayment", new { id = item.Id })')">@item.PrePaymentInfoNumber</a></td>
                        <td>@item.AgentPeoper</td>
                        <td>@item.RestaurantInfoName</td>
                        <td>@item.AccountName</td>
                        <td>@item.PrePaymentPrice</td>
                        <td>
                            @if (IsGranted(FwProject.Authorization.PermissionNames.Finance_Operation_ModifyAdvance))
                            {
                                <button class="btn btn-success btn-xs" onclick="top.window.openTab(1120,'预收单[@item.PrePaymentInfoNumber]','@Url.Action("EditAdvancePayment", new { id = item.Id })')"><i class="fa fa-edit"></i>编辑</button>
                            }
                            @if (IsGranted(FwProject.Authorization.PermissionNames.Finance_Operation_DeleteAdvance))
                            {
                                <button class="btn btn-danger btn-xs" data-toggle="modal" data-target="#modal_del" data-url="@Url.Action("DeleteAdvancePayment", new { id = item.Id })"><i class="fa fa-times"></i>删除</button>
                            }
                        </td>
                    </tr>
                }
            }
        </tbody>
    </table>
</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        @*共 @Model.TotalItemCount 条，@Model.PageSize 条/页 当前第 @Model.PageNumber/@Model.PageCount 页*@
        共 @Model.TotalItemCount 条，
        <select class="form-control" id="pageSize" style="width:70px;display:initial">
            @for (int z = 10; z < 100; z = z + 10)
            {
                if (z == Model.PageSize)
                {
                    <option selected value="@z">@z</option>
                }
                else
                {
                    <option value="@z">@z</option>
                }
            }
        </select> &nbsp;条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        <input type="hidden" id="pageurl" value="&keyword=@(Context.Request.Query["keyword"])&PrePaymentInfoStatus=@(Context.Request.Query["PrePaymentInfoStatus"])" />
        @Html.PagedListPager(Model, page => Url.Action("AdvancePayment", new { pageIdx = page, size = Context.Request.Query["size"], keyword = Context.Request.Query["keyword"], PrePaymentInfoStatus = Context.Request.Query["PrePaymentInfoStatus"] }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>
